package cc.lj.internal.merchant.interfaces.facade;

import cc.lj.internal.api.merchant.dto.PropertyResourcesApiDTO;
import cc.lj.internal.core.exception.SysExceptionEnum;
import cc.lj.internal.core.http.HttpResult;
import cc.lj.internal.merchant.application.service.PropertyResourcesAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 物业资源展位接口信息
 * @author liangxifeng
 * @date 2021-12-25
 */

@RestController
@RequestMapping("/propertyResources")
@Api(tags = "物业资源展位接口信息")
@Slf4j
@Validated
public class PropertyResourcesController {

    @Resource(name = "propertyResourcesAppService")
    private PropertyResourcesAppService resourcesAppService;

    /**
     *某个区域下的在租展位以及该展位的日租金接口List
     * @param relationId 物业资源分表property_relation主键
     * @return 在租展位以及该展位的日租金List
     */
    @ApiOperation(value = "某个区域下的在租展位以及该展位的日租金接口List",notes = "错误码：")
    @PostMapping("/getRentingResourceListByArea")
    public HttpResult<List<PropertyResourcesApiDTO>> getRentingResourceListByArea(@RequestParam Integer relationId) {
        List<PropertyResourcesApiDTO> resourcesList = resourcesAppService.getRentingResourceListByArea(relationId);
        return HttpResult.success(SysExceptionEnum.SUCCESS.getCode(),SysExceptionEnum.SUCCESS.getMessage(),resourcesList);

    }
}
